/* Version definitions */
#undef NTDDI_VERSION
#define NTDDI_VERSION NTDDI_WIN7
#undef _WIN32_WINNT
#define _WIN32_WINNT _WIN32_WINNT_WIN7

#include <ndk/ntifs.h>
#include <ndk/ndk/ntndk.h>

#define C_ASSERT_FIELD(Type, Offset, MemberType, MemberName) C_ASSERT(FIELD_OFFSET(Type, MemberName) == Offset);

/* KTHREAD */
C_ASSERT_FIELD(KTHREAD, 0x000, DISPATCHER_HEADER, Header)
C_ASSERT_FIELD(KTHREAD, 0x010, ULONG64, CycleTime)
C_ASSERT_FIELD(KTHREAD, 0x018, ULONG, HighCycleTime)
C_ASSERT_FIELD(KTHREAD, 0x020, ULONG64, QuantumTarget)
C_ASSERT_FIELD(KTHREAD, 0x028, PVOID, InitialStack)
C_ASSERT_FIELD(KTHREAD, 0x02C, PVOID, StackLimit)
C_ASSERT_FIELD(KTHREAD, 0x030, PVOID, KernelStack)
C_ASSERT_FIELD(KTHREAD, 0x034, ULONG, ThreadLock)
C_ASSERT_FIELD(KTHREAD, 0x038, KWAIT_STATUS_REGISTER, WaitRegister)
C_ASSERT_FIELD(KTHREAD, 0x039, UCHAR, Running)
C_ASSERT_FIELD(KTHREAD, 0x03A, UCHAR, Alerted)
C_ASSERT_FIELD(KTHREAD, 0x03C, LONG, MiscFlags)
C_ASSERT_FIELD(KTHREAD, 0x040, KAPC_STATE, ApcState)
C_ASSERT_FIELD(KTHREAD, 0x040, UCHAR, ApcStateFill)
C_ASSERT_FIELD(KTHREAD, 0x057, CHAR, Priority)
C_ASSERT_FIELD(KTHREAD, 0x058, ULONG, NextProcessor)
C_ASSERT_FIELD(KTHREAD, 0x05C, ULONG, DeferredProcessor)
C_ASSERT_FIELD(KTHREAD, 0x060, ULONG, ApcQueueLock)
C_ASSERT_FIELD(KTHREAD, 0x064, ULONG, ContextSwitches)
C_ASSERT_FIELD(KTHREAD, 0x068, UCHAR, State)
C_ASSERT_FIELD(KTHREAD, 0x069, CHAR, NpxState)
C_ASSERT_FIELD(KTHREAD, 0x06A, UCHAR, WaitIrql)
C_ASSERT_FIELD(KTHREAD, 0x06B, CHAR, WaitMode)
C_ASSERT_FIELD(KTHREAD, 0x06C, LONG, WaitStatus)
C_ASSERT_FIELD(KTHREAD, 0x070, KWAIT_BLOCK*, WaitBlockList)
C_ASSERT_FIELD(KTHREAD, 0x074, LIST_ENTRY, WaitListEntry)
C_ASSERT_FIELD(KTHREAD, 0x074, SINGLE_LIST_ENTRY, SwapListEntry)
C_ASSERT_FIELD(KTHREAD, 0x07C, KQUEUE*, Queue)
C_ASSERT_FIELD(KTHREAD, 0x080, ULONG, WaitTime)
C_ASSERT_FIELD(KTHREAD, 0x084, SHORT, KernelApcDisable)
C_ASSERT_FIELD(KTHREAD, 0x086, SHORT, SpecialApcDisable)
C_ASSERT_FIELD(KTHREAD, 0x084, ULONG, CombinedApcDisable)
C_ASSERT_FIELD(KTHREAD, 0x088, PVOID, Teb)
C_ASSERT_FIELD(KTHREAD, 0x090, KTIMER, Timer)
C_ASSERT_FIELD(KTHREAD, 0x0B8, LONG, ThreadFlags)
C_ASSERT_FIELD(KTHREAD, 0x0BC, PVOID, ServiceTable)
C_ASSERT_FIELD(KTHREAD, 0x0C0, KWAIT_BLOCK, WaitBlock)
C_ASSERT_FIELD(KTHREAD, 0x120, LIST_ENTRY, QueueListEntry)
C_ASSERT_FIELD(KTHREAD, 0x128, KTRAP_FRAME*, TrapFrame)
C_ASSERT_FIELD(KTHREAD, 0x12C, PVOID, FirstArgument)
C_ASSERT_FIELD(KTHREAD, 0x130, PVOID, CallbackStack)
C_ASSERT_FIELD(KTHREAD, 0x130, ULONG, CallbackDepth)
C_ASSERT_FIELD(KTHREAD, 0x134, UCHAR, ApcStateIndex)
C_ASSERT_FIELD(KTHREAD, 0x135, CHAR, BasePriority)
C_ASSERT_FIELD(KTHREAD, 0x136, CHAR, PriorityDecrement)
C_ASSERT_FIELD(KTHREAD, 0x137, UCHAR, Preempted)
C_ASSERT_FIELD(KTHREAD, 0x138, UCHAR, AdjustReason)
C_ASSERT_FIELD(KTHREAD, 0x139, CHAR, AdjustIncrement)
C_ASSERT_FIELD(KTHREAD, 0x13A, CHAR, PreviousMode)
C_ASSERT_FIELD(KTHREAD, 0x13B, CHAR, Saturation)
C_ASSERT_FIELD(KTHREAD, 0x13C, ULONG, SystemCallNumber)
C_ASSERT_FIELD(KTHREAD, 0x140, ULONG, FreezeCount)
C_ASSERT_FIELD(KTHREAD, 0x144, GROUP_AFFINITY, UserAffinity)
C_ASSERT_FIELD(KTHREAD, 0x150, KPROCESS*, Process)
C_ASSERT_FIELD(KTHREAD, 0x154, GROUP_AFFINITY, Affinity)
C_ASSERT_FIELD(KTHREAD, 0x160, ULONG, IdealProcessor)
C_ASSERT_FIELD(KTHREAD, 0x164, ULONG, UserIdealProcessor)
C_ASSERT_FIELD(KTHREAD, 0x168, KAPC_STATE*, ApcStatePointer)
C_ASSERT_FIELD(KTHREAD, 0x170, KAPC_STATE, SavedApcState)
C_ASSERT_FIELD(KTHREAD, 0x170, UCHAR, SavedApcStateFill)
C_ASSERT_FIELD(KTHREAD, 0x187, UCHAR, WaitReason)
C_ASSERT_FIELD(KTHREAD, 0x188, CHAR, SuspendCount)
C_ASSERT_FIELD(KTHREAD, 0x189, CHAR, Spare1)
C_ASSERT_FIELD(KTHREAD, 0x18A, UCHAR, OtherPlatformFill)
C_ASSERT_FIELD(KTHREAD, 0x18C, PVOID, Win32Thread)
C_ASSERT_FIELD(KTHREAD, 0x190, PVOID, StackBase)
C_ASSERT_FIELD(KTHREAD, 0x194, KAPC, SuspendApc)
C_ASSERT_FIELD(KTHREAD, 0x194, UCHAR, SuspendApcFill0)
C_ASSERT_FIELD(KTHREAD, 0x195, UCHAR, ResourceIndex)
C_ASSERT_FIELD(KTHREAD, 0x194, UCHAR, SuspendApcFill1)
C_ASSERT_FIELD(KTHREAD, 0x197, UCHAR, QuantumReset)
C_ASSERT_FIELD(KTHREAD, 0x194, UCHAR, SuspendApcFill2)
C_ASSERT_FIELD(KTHREAD, 0x198, ULONG, KernelTime)
C_ASSERT_FIELD(KTHREAD, 0x194, UCHAR, SuspendApcFill3)
C_ASSERT_FIELD(KTHREAD, 0x1B8, KPRCB*, WaitPrcb)
C_ASSERT_FIELD(KTHREAD, 0x194, UCHAR, SuspendApcFill4)
C_ASSERT_FIELD(KTHREAD, 0x1BC, PVOID, LegoData)
C_ASSERT_FIELD(KTHREAD, 0x194, UCHAR, SuspendApcFill5)
C_ASSERT_FIELD(KTHREAD, 0x1C3, UCHAR, LargeStack)
C_ASSERT_FIELD(KTHREAD, 0x1C4, ULONG, UserTime)
C_ASSERT_FIELD(KTHREAD, 0x1C8, KSEMAPHORE, SuspendSemaphore)
C_ASSERT_FIELD(KTHREAD, 0x1C8, UCHAR, SuspendSemaphorefill)
C_ASSERT_FIELD(KTHREAD, 0x1DC, ULONG, SListFaultCount)
C_ASSERT_FIELD(KTHREAD, 0x1E0, LIST_ENTRY, ThreadListEntry)
C_ASSERT_FIELD(KTHREAD, 0x1E8, LIST_ENTRY, MutantListHead)
C_ASSERT_FIELD(KTHREAD, 0x1F0, PVOID, SListFaultAddress)
C_ASSERT_FIELD(KTHREAD, 0x1F4, KTHREAD_COUNTERS*, ThreadCounters)
C_ASSERT_FIELD(KTHREAD, 0x1F8, XSTATE_SAVE*, XStateSave)
